package com.cman777.springc.common.helper.jacksonserializer;

import com.cman777.springc.common.bean.Iface.EnumIFace;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;

/**
 * @author chenzhicong
 * @time 2020/6/24 13:47
 */
public class EnumSerializer extends JsonSerializer<EnumIFace> {
    @Override
    public void serialize(EnumIFace value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        gen.writeString(value.getCode().toString());
    }
}
